#region copyright 2005 jingstudio
/**
 Dev by alittlefish(jmtek)
 MSN: jing226@hotmail.com
 OICQ: 24417417
 Email: alittlefish2005@yahoo.com.cn 
 */
#endregion

#region Importing
using System;
using System.Drawing;
#endregion

namespace Jingstudio.WatermarkMaker.Watermark
{
	public abstract class AlignedPosition : WatermarkPosition
	{
		protected float _offsetX;
		protected float _offsetY;

		#region Cstr
		public AlignedPosition()
		{
			this._offsetX = -1.0f;
			this._offsetY = -1.0f;
		}
		#endregion

		public override RectangleF GetPosition(Size imageSize, Size watermarkSize)
		{
			if (this._offsetX == -1.0f && this._offsetY == -1.0f)
			{
				float tWidht = (float)imageSize.Width;
				float tHeight = (float)imageSize.Height;

				this._offsetX = tWidht * 0.05f;
				this._offsetY = tHeight * 0.05f;
			}

			return this.GetRectangle(imageSize, watermarkSize);
		}

		protected abstract RectangleF GetRectangle(Size imageSize, Size watermarkSize);
	}
}
